﻿using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CodeToolBox.Form
{
    public partial class StringSetForm : UIForm
    {
        public StringSetForm()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 转换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void uiButton1_Click(object sender, EventArgs e)
        {
            try
            {
                string dzhuan = uiRichTextBox1.Text ;
                //去掉换行
                string[] listdzhuan = dzhuan.Split("\n");
                dzhuan = string.Join("", listdzhuan);
                string[] sadsada = dzhuan.Split(",");
                sadsada= sadsada.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray();
                string asdasdas = string.Join(",", sadsada).Trim();
                asdasdas= string.Join("", asdasdas.Split(default(string[]), StringSplitOptions.RemoveEmptyEntries));
                uiRichTextBox2.Text = asdasdas;
                ShowSuccessTip("转换成功！");
            }
            catch (Exception ex)
            {

                ShowErrorNotifier(ex.Message, true, 5000);
            }
        }

        private void uiButton2_Click(object sender, EventArgs e)
        {
            Clipboard.SetText(uiRichTextBox2.Text);
            ShowSuccessTip("复制成功！");
        }

        private void uiButton3_Click(object sender, EventArgs e)
        {
            uiRichTextBox2.Text = "";
            uiRichTextBox1.Text = "";
        }
    }
}
